# Copyright (c) 2021 Presto Labs Pte. Ltd.
# Author: leon

import json
import logging
import os
from coin2.support.product_info.spot_uniswap_v2 import convert_coin1_constants


pi_file = 'data/coin2/product_info/Spot.Uniswap.v2.json'
with open(pi_file) as f:
  static_constants = convert_coin1_constants(json.load(f)['product_infos'])
coin_only_exchange = True

dynamic_constants = {}
if int(os.getenv('USE_DYNAMIC_SYMBOL', 0)):
  try:
    from coin2.support.product_info.spot_uniswap_v2 import gen_coin1_constants
    dynamic_constants = gen_coin1_constants()
  except Exception as e:
    logging.error('Failed to use uniswapv2 dynamic symbols! %s', e)

quote_currency_list = list(set(
    static_constants.get('quote_currency_list', []) +
    dynamic_constants.get('quote_currency_list', [])))
currency_list = list(set(
    static_constants.get('currency_list', []) +
    dynamic_constants.get('currency_list', [])))
symbol_list = list(set(
    static_constants.get('symbol_list', []) +
    dynamic_constants.get('symbol_list', [])))


deployment_address = {
  'UniswapV2Factory': '0x5C69bEe701ef814a2B6a3EDD4B1652CB9cc5aA6f',
  'UniswapV2Router02': '0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D',
}
